package com.utn.tp.integrador.entidades;

import java.io.Serializable;
import java.util.ArrayList;

public class Contacto implements Serializable {

	private static final long serialVersionUID = 1L;

	private String name;
	private String id;
	private ArrayList<Telefono> telephoneNumbers;
	private ArrayList<ContactEmail> emails;
	private String nombreUsuario;
	private String imagenContacto;

	public Contacto() {
		telephoneNumbers = new ArrayList<Telefono>(0);
		emails = new ArrayList<ContactEmail>(0);
	}

	public void addEmail(String email, String emailType) {
		ContactEmail emailNew = new ContactEmail();
		emailNew.setValue(email);
		emailNew.setType(emailType);
		emails.add(emailNew);
	}

	public void addTelephoneNumber(String numero, String tipo) {
		Telefono telefono = new Telefono();
		telefono.setValue(numero);
		telefono.setType(tipo);
		telephoneNumbers.add(telefono);
		// telephoneNumbers.add(number);
	}

	public ArrayList<ContactEmail> getEmails() {
		return emails;
	}

	public String getId() {
		return id;
	}

	public String getImagenContacto() {
		return imagenContacto;
	}

	public ArrayList<String> getListaEmails(boolean showType) {
		ArrayList<String> listaMails = new ArrayList<String>();

		if (showType) {
			for (ContactEmail mail : emails) {
				listaMails.add(mail.toString());
			}
		} else {
			for (ContactEmail mail : emails) {
				listaMails.add(mail.getValue());
			}
		}
		return listaMails;
	}

	public ArrayList<String> getListaTelefonos(boolean showType) {
		ArrayList<String> listaTelefonos = new ArrayList<String>();
		if (showType) {
			for (Telefono telefono : telephoneNumbers) {
				listaTelefonos.add(telefono.toString());
			}
		} else {
			for (Telefono telefono : telephoneNumbers) {
				listaTelefonos.add(telefono.getValue());
			}
		}

		return listaTelefonos;
	}

	public String getName() {
		return name;
	}

	public String getNombreUsuario() {
		return nombreUsuario;
	}

	public ArrayList<Telefono> getTelephoneNumbers() {
		return telephoneNumbers;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setImagenContacto(String imagenContacto) {
		this.imagenContacto = imagenContacto;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setNombreUsuario(String nombreUsuario) {
		this.nombreUsuario = nombreUsuario;
	}

	@Override
	public String toString() {
		return id + " " + name;
	}

}
